Skip to content

Adding more parameters to the R table command#56

Open
mahaalbashir wants to merge 2 commits into
mainfrom
54-new-feature-request-map-all-params-in-r-table-command-onto-the-crosstab-command
Open

Adding more parameters to the R table command#56
mahaalbashir wants to merge 2 commits into
mainfrom
54-new-feature-request-map-all-params-in-r-table-command-onto-the-crosstab-command

Conversation

@mahaalbashir

Copy link
Copy Markdown
Collaborator
  1. The exclude parameter: All the items that the user wants to exclude are deleted from the data before sending it to Python.

  2. The useNA parameter: If useNA = "no", NAs and NaNs are removed from the data before sending it to Python. If useNA = "ifany", the data is sent as is. If useNA = "always" and the data doesn't have NAs, the NA level is added as a factor before sending the data to Python.

Whatever the value of the useNA parameter is, the index and columns parameters are converted to R factors. Using factors guarantees that empty categories are not dropped from the final table and allows the addition of the NA level when useNA = "always".

The factors are manually converted to a Pandas categoricals because reticulate doesn't do this automatically. It just throws away the levels and sends the raw data.

The automatic translation of data between Python and R is disabled so that I can manipulate the data before displaying it. Because reticulate removes the index names and replaces them with numbers, I am resetting the indexes before translating the Python DataFrame to R, and then setting them back after the translation.

One thing to notice is that in the case of useNA = "always", when we inject the NA level, the current Python version will actually delete this column/row because every column/row with all zeros is deleted from the DataFrame. However, a message will be sent to the user to show exactly which column and row were deleted.

A utils.R file is created to hold the helper functions.

@mahaalbashir mahaalbashir force-pushed the 54-new-feature-request-map-all-params-in-r-table-command-onto-the-crosstab-command branch from 4468761 to 84c44f9 Compare June 22, 2026 15:29
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1daa082) to head (2a8dcbf).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #56   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         5    +1     
  Lines          115       161   +46     
=========================================
+ Hits           115       161   +46     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mahaalbashir mahaalbashir force-pushed the 54-new-feature-request-map-all-params-in-r-table-command-onto-the-crosstab-command branch 3 times, most recently from ae9d650 to 54e0048 Compare June 23, 2026 00:07
@mahaalbashir mahaalbashir requested a review from jim-smith June 23, 2026 00:08
@mahaalbashir mahaalbashir force-pushed the 54-new-feature-request-map-all-params-in-r-table-command-onto-the-crosstab-command branch 3 times, most recently from 3e5c0f7 to f55c99f Compare June 23, 2026 23:54
@mahaalbashir mahaalbashir force-pushed the 54-new-feature-request-map-all-params-in-r-table-command-onto-the-crosstab-command branch from f55c99f to 2a8dcbf Compare June 24, 2026 00:19
@mahaalbashir mahaalbashir requested a review from JessUWE June 24, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New Feature Request] Map all params in R table command onto the crosstab command

1 participant